<?php
/**
 * @user:andy
 * @date:2021/7/14
 * @company:http://www.sjdphp.com
 * @desc:
 */

namespace app\admin\validate;


use think\Validate;

class TermsValidate extends Validate
{
    protected $rule = [
        'terms_id'     => 'require|number',
        'terms_name'   => 'require',
        'terms_action' => ['require','number','in' => '1,2,3'],
    ];

    protected $message = [
        'terms_id.require'     => '词语ID不能为空',
        'terms_id.number'      => '词语ID不合法',
        'terms_name.require'   => '词语名称不能为空',
        'terms_action.require' => '过滤动作不能为空',
        'terms_action.number'  => '过滤动作格式错误',
        'terms_action.in'      => '过滤动作参数错误',
    ];

    protected $scene = [
        'add'  => ['terms_name','terms_action'],
        'edit' => ['terms_name','terms_action','terms_id'],
    ];
}